package com.jtcoding.chat.config;

import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

import java.io.IOException;

/**
 * @Author jason.tang
 * @Date 2019-08-18 14:46
 * @Desc
 */

@SpringBootConfiguration
public class FastDFSConfig {

    @Bean
    public TrackerServer getTrackerServer() throws IOException {
        TrackerClient trackerClient = new TrackerClient();
        return trackerClient.getConnection();
    }

    @Bean
    public StorageClient getStorageClient(TrackerServer trackerServer) throws IOException {
        return new StorageClient(trackerServer, null);
    }
}
